Skip to main content

Admin Functions

This section details the administrative functions available in the contract, including staker management and role transfers.

Presale Staker Management

addPresaleStaker

Function Type: external
Function Signature: addPresaleStaker(address)
Function Selector: 0x6c58f77b

Allows the admin to add a single new presale staker to the contract. Limited to a maximum of 800 total presale stakers.

Parameters

ParameterTypeDescription
_stakeraddressAddress of the new presale staker

Workflow

  1. Admin Verification: Verifies the caller has admin privileges using onlyOwner modifier
  2. Limit Check: Checks that adding this staker won't exceed the 800 staker limit (LIMIT_PRESALE_STAKER)
  3. Add Staker: Sets userPresaleStaker[_staker].isAllow = true to enable presale staking for the address
  4. Increment Counter: Increases presaleStakerCount to track total presale stakers

addPresaleStakers

Function Type: external
Function Signature: addPresaleStakers(address[])
Function Selector: 0xbe100345

Allows the admin to add multiple presale stakers in a single transaction. Limited to a maximum of 800 total presale stakers.

Parameters

ParameterTypeDescription
_stakersaddress[]Array of addresses of new presale stakers

Workflow

  1. Admin Verification: Verifies the caller has admin privileges using onlyOwner modifier
  2. Batch Processing: Iterates through the array of staker addresses
  3. Limit Check: For each address, checks that adding this staker won't exceed the 800 staker limit (LIMIT_PRESALE_STAKER)
  4. Add Staker: Sets userPresaleStaker[_stakers[i]].isAllow = true for each address
  5. Increment Counter: Increases presaleStakerCount for each successfully added staker

Role Transfer Processes

Admin Change Process

The admin role transfer follows a secure two-step process with a mandatory waiting period.

proposeAdmin

Function Type: external
Function Signature: proposeAdmin(address)
Function Selector: 0x147bf6c4

Initiates the admin change process by proposing a new admin address.

Parameters
ParameterTypeDescription
_newAdminaddressAddress of the proposed new admin

rejectProposalAdmin

Function Type: external
Function Signature: rejectProposalAdmin()
Function Selector: 0xb38c950a

Allows the current admin to cancel a pending admin change proposal.

acceptNewAdmin

Function Type: external
Function Signature: acceptNewAdmin()
Function Selector: 0xcd6b5460

Allows the proposed admin to accept the role after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The current admin calls proposeAdmin with the new admin address
    • Sets admin.proposal = _newAdmin and admin.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The current admin can call rejectProposalAdmin to cancel the proposal at any time
    • Resets admin.proposal = address(0) and admin.timeToAccept = 0
  3. Role Acceptance:

    • The proposed admin must wait 24 hours (1 day) after the proposal timestamp
    • The proposed admin calls acceptNewAdmin to complete the transfer
    • Function verifies msg.sender == admin.proposal and admin.timeToAccept <= block.timestamp
    • Updates admin.actual = admin.proposal and resets proposal fields

Admin Change


Golden Fisher Role Transfer

The golden fisher role transfer follows a similar secure two-step process with a mandatory waiting period.

proposeGoldenFisher

Function Type: external
Function Signature: proposeGoldenFisher(address)
Function Selector: 0x489c5ad4

Initiates the golden fisher change process by proposing a new golden fisher address.

Parameters
ParameterTypeDescription
_goldenFisheraddressAddress of the proposed new golden fisher

rejectProposalGoldenFisher

Function Type: external
Function Signature: rejectProposalGoldenFisher()
Function Selector: 0xa84e9f23

Allows the current golden fisher to cancel a pending golden fisher change proposal.

acceptNewGoldenFisher

Function Type: external
Function Signature: acceptNewGoldenFisher()
Function Selector: 0x34dd90d6

Allows the admin to confirm the new golden fisher role assignment after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The admin calls proposeGoldenFisher with the new golden fisher address
    • Sets goldenFisher.proposal = _goldenFisher and goldenFisher.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The admin can call rejectProposalGoldenFisher to cancel the proposal at any time
    • Resets goldenFisher.proposal = address(0) and goldenFisher.timeToAccept = 0
  3. Role Confirmation:

    • The admin must wait 24 hours (1 day) after the proposal timestamp
    • The admin calls acceptNewGoldenFisher to complete the transfer
    • Function verifies goldenFisher.timeToAccept <= block.timestamp
    • Updates goldenFisher.actual = goldenFisher.proposal and resets proposal fields

Golden Fisher Change


Staking Unlock Period Modification

The staking unlock period modification follows a secure two-step process with a mandatory waiting period.

proposeSetSecondsToUnlockStaking

Function Type: external
Function Signature: proposeSetSecondsToUnlockStaking(uint256)
Function Selector: 0x6b2933a2

Initiates the process to change the staking unlock period.

Parameters
ParameterTypeDescription
_secondsToUnlockStakinguint256New staking unlock period in seconds

rejectProposalSetSecondsToUnlockStaking

Function Type: external
Function Signature: rejectProposalSetSecondsToUnlockStaking()
Function Selector: 0x7c25faef

Allows the current admin to cancel a pending staking unlock period change proposal.

acceptSetSecondsToUnlockStaking

Function Type: external
Function Signature: acceptSetSecondsToUnlockStaking()
Function Selector: 0x610a0476

Allows the admin to confirm the new staking unlock period after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The admin calls proposeSetSecondsToUnlockStaking with the new unlock period value
    • Sets secondsToUnlockStaking.proposal = _secondsToUnlockStaking and secondsToUnlockStaking.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The admin can call rejectProposalSetSecondsToUnlockStaking to cancel the proposal at any time
    • Resets secondsToUnlockStaking.proposal = 0 and secondsToUnlockStaking.timeToAccept = 0
  3. Change Confirmation:

    • The admin must wait 24 hours (1 day) after the proposal timestamp
    • The admin calls acceptSetSecondsToUnlockStaking to implement the change
    • Function verifies secondsToUnlockStaking.timeToAccept <= block.timestamp
    • Updates secondsToUnlockStaking.actual = secondsToUnlockStaking.proposal and resets proposal fields

Seconds To Unlock Staking Change


Full Unstaking Period Modification

The full unstaking unlock period modification follows a secure two-step process with a mandatory waiting period.

prepareSetSecondsToUnlockFullUnstaking

Function Type: external
Function Signature: prepareSetSecondsToUnllockFullUnstaking(uint256)
Function Selector: 0x3d8ff69a

Initiates the process to change the full unstaking unlock period.

Parameters
ParameterTypeDescription
_secondsToUnllockFullUnstakinguint256New full unstaking unlock period in seconds

cancelSetSecondsToUnlockFullUnstaking

Function Type: external
Function Signature: cancelSetSecondsToUnllockFullUnstaking()
Function Selector: 0xb384c574

Allows the current admin to cancel a pending full unstaking unlock period change proposal.

confirmSetSecondsToUnlockFullUnstaking

Function Type: external
Function Signature: confirmSetSecondsToUnllockFullUnstaking()
Function Selector: 0x8f4b3f28

Allows the admin to confirm the new full unstaking unlock period after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The admin calls prepareSetSecondsToUnllockFullUnstaking with the new unlock period value
    • Sets secondsToUnllockFullUnstaking.proposal = _secondsToUnllockFullUnstaking and secondsToUnllockFullUnstaking.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The admin can call cancelSetSecondsToUnllockFullUnstaking to cancel the proposal at any time
    • Resets secondsToUnllockFullUnstaking.proposal = 0 and secondsToUnllockFullUnstaking.timeToAccept = 0
  3. Change Confirmation:

    • The admin must wait 24 hours (1 day) after the proposal timestamp
    • The admin calls confirmSetSecondsToUnllockFullUnstaking to implement the change
    • Function verifies secondsToUnllockFullUnstaking.timeToAccept <= block.timestamp
    • Updates secondsToUnllockFullUnstaking.actual = secondsToUnllockFullUnstaking.proposal and resets proposal fields

Seconds To Unlock Full Unstaking Change


Flag Change Processes

Public Staking Flag Modification

The public staking flag modification follows a secure two-step process with a mandatory waiting period.

prepareChangeAllowPublicStaking

Function Type: external
Function Signature: prepareChangeAllowPublicStaking()
Function Selector: 0x27be0557

Initiates the process to toggle the allow public staking flag.

cancelChangeAllowPublicStaking

Function Type: external
Function Signature: cancelChangeAllowPublicStaking()
Function Selector: 0xb996b6c4

Allows the current admin to cancel a pending public staking flag change proposal.

confirmChangeAllowPublicStaking

Function Type: external
Function Signature: confirmChangeAllowPublicStaking()
Function Selector: 0x681f02ac

Allows the admin to confirm the new public staking flag state after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The admin calls prepareChangeAllowPublicStaking to initiate the flag toggle
    • Sets allowPublicStaking.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The admin can call cancelChangeAllowPublicStaking to cancel the proposal at any time
    • Resets allowPublicStaking.timeToAccept = 0
  3. Change Confirmation:

    • The admin must wait 24 hours (1 day) after the proposal timestamp
    • The admin calls confirmChangeAllowPublicStaking to implement the change
    • Function verifies allowPublicStaking.timeToAccept <= block.timestamp
    • Creates new BoolTypeProposal with flag: !allowPublicStaking.flag and timeToAccept: 0

Allow Public Staking Change


Presale Staking Flag Modification

The presale staking flag modification follows a secure two-step process with a mandatory waiting period.

prepareChangeAllowPresaleStaking

Function Type: external
Function Signature: prepareChangeAllowPresaleStaking()
Function Selector: 0xdfb2b3a4

Initiates the process to toggle the allow presale staking flag.

cancelChangeAllowPresaleStaking

Function Type: external
Function Signature: cancelChangeAllowPresaleStaking()
Function Selector: 0x7068dc65

Allows the current admin to cancel a pending presale staking flag change proposal.

confirmChangeAllowPresaleStaking

Function Type: external
Function Signature: confirmChangeAllowPresaleStaking()
Function Selector: 0x1e9c210f

Allows the admin to confirm the new presale staking flag state after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The admin calls prepareChangeAllowPresaleStaking to initiate the flag toggle
    • Sets allowPresaleStaking.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The admin can call cancelChangeAllowPresaleStaking to cancel the proposal at any time
    • Resets allowPresaleStaking.timeToAccept = 0
  3. Change Confirmation:

    • The admin must wait 24 hours (1 day) after the proposal timestamp
    • The admin calls confirmChangeAllowPresaleStaking to implement the change
    • Function verifies allowPresaleStaking.timeToAccept <= block.timestamp
    • Creates new BoolTypeProposal with flag: !allowPresaleStaking.flag and timeToAccept: 0

Allow Presale Staking Change


Estimator Management

proposeEstimator

Function Type: external
Function Signature: proposeEstimator(address)

Initiates the process to change the estimator contract address.

Parameters

ParameterTypeDescription
_estimatoraddressAddress of the proposed new estimator

rejectProposalEstimator

Function Type: external
Function Signature: rejectProposalEstimator()

Allows the current admin to cancel a pending estimator change proposal.

acceptNewEstimator

Function Type: external
Function Signature: acceptNewEstimator()

Allows the admin to confirm the new estimator address after the waiting period.

Complete Workflow

  1. Proposal Initiation:

    • The admin calls proposeEstimator with the new estimator address
    • Sets estimator.proposal = _estimator and estimator.timeToAccept = block.timestamp + 1 days
  2. Proposal Cancellation (Optional):

    • The admin can call rejectProposalEstimator to cancel the proposal at any time
    • Resets estimator.proposal = address(0) and estimator.timeToAccept = 0
  3. Change Confirmation:

    • The admin must wait 24 hours (1 day) after the proposal timestamp
    • The admin calls acceptNewEstimator to implement the change
    • Function verifies estimator.timeToAccept <= block.timestamp
    • Updates estimator.actual = estimator.proposal and resets proposal fields